import { defineComponent } from "vue";
import style from "./index.module.less";
import CardView from "../CardView";
import { Swipe, SwipeItem } from "vant";
import IconText from "../IconText";
import { IMessageItemProps, messageProps } from "./types";
import MessageItem from "./item";
import RowView from "../RowView";
export default defineComponent({
  name: "",
  props: messageProps,
  setup(props) {
    const getShowRight = (item: IMessageItemProps) => {
      if (props.showRight != undefined) {
        return props.showRight;
      } else {
        return item.showRight || true;
      }
    };
    const renderSwipItem = (item: IMessageItemProps) => {
      return (
        <MessageItem
          showRight={getShowRight(item)}
          {...item}
          class="mt-[10px]"
        />
      );
    };
    return () => {
      return (
        <CardView>
          <RowView>
            <div>{props.data.map((e) => renderSwipItem(e))}</div>
          </RowView>
        </CardView>
      );
    };
  },
});
